# from django.contrib import admin
# from .models import Admin, Submitter, DataChange, DataTicket, QaPair, ScenicSpot
#
# # Register your models here.
#
# class AdminAdmin(admin.ModelAdmin):
#     list_display = ('admin_id', 'register_time', 'last_operation_time', 'responsible_scenic_id', 'submitted_tickets')
#     search_fields = ('admin_id',)
#     list_filter = ('register_time',)
#
# class SubmitterAdmin(admin.ModelAdmin):
#     list_display = ('submitter_id', 'register_time', 'last_operation_time', 'submitted_tickets')
#     search_fields = ('submitter_id',)
#     list_filter = ('register_time',)
#
# class DataChangeAdmin(admin.ModelAdmin):
#     list_display = ('change_id', 'qa', 'current_status', 'modification_type', 'change_time', 'modified_by')
#     search_fields = ('qa__question', 'modified_by')
#     list_filter = ('current_status', 'change_time')
#
# class DataTicketAdmin(admin.ModelAdmin):
#     list_display = ('ticket_id', 'ticket_type', 'question', 'status', 'submit_time', 'submitter', 'assigned_admin')
#     search_fields = ('question', 'ticket_type', 'submitter__submitter_id', 'assigned_admin__admin_id')
#     list_filter = ('status', 'submit_time')
#
# class QaPairAdmin(admin.ModelAdmin):
#     list_display = ('qa_id', 'jq', 'question', 'answer', 'update_time')
#     search_fields = ('question', 'answer')
#     list_filter = ('update_time',)
#
# class ScenicSpotAdmin(admin.ModelAdmin):
#     list_display = ('jq_id', 'jq_name', 'jq_city', 'jq_address', 'jq_rating', 'jq_type', 'qa_count', 'responsible_admin')
#     search_fields = ('jq_name', 'jq_city')
#     list_filter = ('jq_rating', 'jq_type')
#
# admin.site.register(Admin, AdminAdmin)
# admin.site.register(Submitter, SubmitterAdmin)
# admin.site.register(DataChange, DataChangeAdmin)
# admin.site.register(DataTicket, DataTicketAdmin)
# admin.site.register(QaPair, QaPairAdmin)
# admin.site.register(ScenicSpot, ScenicSpotAdmin)


from django.contrib import admin
from .models import Admin, Submitter, DataChange, DataTicket, QaPair, ScenicSpot

# Admin 模型管理
@admin.register(Admin)
class AdminAdmin(admin.ModelAdmin):
    list_display = ('admin_id', 'admin_pass', 'register_time', 'last_operation_time', 'responsible_scenic_id', 'submitted_tickets')
    search_fields = ('admin_id', 'admin_pass')
    list_filter = ('register_time', 'last_operation_time')
    ordering = ('-register_time',)
    list_per_page = 20


# Submitter 模型管理
@admin.register(Submitter)
class SubmitterAdmin(admin.ModelAdmin):
    list_display = ('submitter_id', 'submitter_pass', 'register_time', 'last_operation_time', 'submitted_tickets')
    search_fields = ('submitter_id', 'submitter_pass')
    list_filter = ('register_time', 'last_operation_time')
    ordering = ('-register_time',)
    list_per_page = 20


# DataChange 模型管理
@admin.register(DataChange)
class DataChangeAdmin(admin.ModelAdmin):
    list_display = ('change_id', 'qa', 'current_status', 'modification_type', 'change_time', 'modified_by', 'ticket')
    search_fields = ('change_id', 'current_status', 'modified_by')
    list_filter = ('current_status', 'change_time')
    ordering = ('-change_time',)
    list_per_page = 20


# DataTicket 模型管理
@admin.register(DataTicket)
class DataTicketAdmin(admin.ModelAdmin):
    list_display = ('ticket_id', 'ticket_type', 'submitter', 'submit_time', 'submit_count', 'assigned_admin', 'status')
    search_fields = ('ticket_id', 'ticket_type', 'submitter__submitter_id', 'assigned_admin__admin_id')
    list_filter = ('ticket_type', 'status', 'submit_time')
    ordering = ('-submit_time',)
    list_per_page = 20


# QaPair 模型管理
@admin.register(QaPair)
class QaPairAdmin(admin.ModelAdmin):
    list_display = ('qa_id', 'jq', 'question', 'answer', 'last_operation_time')
    search_fields = ('qa_id', 'question', 'answer')
    list_filter = ('last_operation_time',)
    ordering = ('-last_operation_time',)
    list_per_page = 20


# ScenicSpot 模型管理
@admin.register(ScenicSpot)
class ScenicSpotAdmin(admin.ModelAdmin):
    list_display = ('jq_id', 'jq_name', 'jq_city', 'jq_rating', 'jq_type', 'qa_count', 'responsible_admin')
    search_fields = ('jq_id', 'jq_name', 'jq_city', 'jq_address')
    list_filter = ('jq_city', 'jq_rating', 'jq_type')
    ordering = ('jq_name',)
    list_per_page = 20

